<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich" >
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>付款申请单</title>
        <script type="text/javascript">
            function showProj() {
                window.open("./pubinfo/projList.jsf", "项目列表", "height=1024,width=800,toolbar=no,menubar=no,scrollbars=no");
            }
            function updateProjSelect(code, name) {
                document.getElementById('emp3:projCode').value = code;
                document.getElementById('emp3:projName').value = name;
            }

            function showDept() {
                window.open("./pubinfo/departmentList.jsf", "部门列表", "height=1024,width=800,toolbar=no,menubar=no,scrollbars=no");
            }
            function updateDept(code, name) {
                document.getElementById('emp3:deptcode').value = code;
                document.getElementById('emp3:deptname').value = name;
            }
            function showCostItem() {
                window.open("./page/pay/check/ecoList.jsf", "经济分类", "height=1024,width=800,toolbar=no,menubar=no,scrollbars=no");
            }
            function updateCostItemName(code, name) {
                document.getElementById('emp3:costcode').value = code;
                document.getElementById('emp3:costname').value = name;
            }
        </script>
        <style type="text/css">
            .inputstype{
                width: 100px !important;
            }
        </style>
    </h:head>
    <h:body>
        <h:form id="emp3">
            <rich:panel header="付款申请单审核列表" styleClass="content-hight">                
                <rich:collapsiblePanel header="查询条件"  switchType="client" expanded="false">
                    <h:panelGrid columns="4">
                        <h:outputLabel value="单据编号：" for="number" />
                        <h:inputText size="17" id="number" value="#{payAppCheck.qea.number}" />
                        <h:outputText value="单据日期："/>
                        <h:panelGroup>
                            <rich:calendar value="#{payAppCheck.qea.numDateStart}"
                                           locale="zh_CN"
                                           popup="true"
                                           datePattern="yyyy-MM-dd"
                                           showApplyButton="false"  inputClass="inputstype"/>
                            至
                            <rich:calendar value="#{payAppCheck.qea.numDateEnd}"
                                           locale="zh_CN"
                                           popup="true"
                                           datePattern="yyyy-MM-dd"
                                           showApplyButton="false"  inputClass="inputstype"/>
                        </h:panelGroup>
                        <h:outputLabel value="单据状态："/>
                        <h:selectOneMenu value="#{payAppCheck.status}" style=" width: 125px;">
                            <f:selectItem itemValue=" " itemLabel="---请 选 择---"/>
                            <f:selectItems value="#{payAppCheck.selectItemList}"/>
                        </h:selectOneMenu>
                        <h:outputLabel value="报销内容：" for="affair" />
                        <h:inputText size="17" id="affair" value="#{payAppCheck.qea.affair}" />
                        <h:outputLabel value="报销金额：" />
                        <h:panelGroup>
                            <h:inputText size="17" id="totalStart" value="#{payAppCheck.qea.totalStart}"/>
                            - <h:inputText size="17" id="totalEnd" value="#{payAppCheck.qea.totalEnd}"/>
                        </h:panelGroup>
                        <h:outputLabel value="预算项目：" for="projName" />
                        <h:inputText size="17" id="projName" value="#{payAppCheck.qea.project.finName}"
                                     onclick="#{rich:component('projPanel')}.show();"/>
                        <h:outputLabel value="经手人员：" for="cpsn_name" />
                        <h:inputText size="17" id="cpsn_name" value="#{payAppCheck.qea.user.cpsn_number}" />
                        <h:outputLabel value="部门：" for="department" />
                        <h:inputText size="17" id="deptname" value="#{payAppCheck.qea.dept.name}"
                                     onclick="#{rich:component('deptPanel')}.show()"/>
                        <h:outputLabel value="支出类别：" for="costClass" />
                        <h:selectOneMenu id="costClass" value="#{payAppCheck.qea.costClass}"
                                         style=" width: 125px;">
                            <f:selectItem itemValue=" " itemLabel="---请 选 择---"/>
                            <f:selectItem itemValue="0" itemLabel="基本支出"/>
                            <f:selectItem itemValue="1" itemLabel="项目支出"/>
                        </h:selectOneMenu>
                        <h:outputLabel value="预算来源：" for="budgetSource" />
                        <h:inputText size="17" id="budgetSource" value="#{payAppCheck.qea.budgetSource}" />
                        <h:outputLabel value="经济分类：" for="costname" />
                        <h:inputText size="17" id="costname" value="#{payAppCheck.qea.costitem.name}"  onclick="showCostItem()" />
                        <h:outputLabel value="支出渠道：" for="costType" />
                        <h:selectOneMenu  id="costType" value="#{payAppCheck.qea.costTypes.code}"
                                          style=" width: 125px;">
                            <f:selectItem itemValue=" " itemLabel="---请 选 择---"/>
                            <f:selectItems value="#{class.selectItemList}" />
                        </h:selectOneMenu>
                        <h:outputLabel value="支付令：" for="paycode" />
                        <h:inputText size="17" id="paycode" value="#{payAppCheck.qea.paycode}" />
                        <h:outputLabel value="核定金额：" />
                        <h:panelGroup>
                            <h:inputText size="17" id="checkaccountStart" value="#{payAppCheck.qea.checkaccountStart}"/>
                            - <h:inputText size="17" id="checkaccountEnd" value="#{payAppCheck.qea.checkaccountEnd}"/>
                        </h:panelGroup>
                        <h:outputText value="审核日期："/>
                        <h:panelGroup>
                            <rich:calendar value="#{payAppCheck.qea.auditDateStart}"
                                           locale="zh_CN"
                                           popup="true"
                                           datePattern="yyyy-MM-dd"
                                           showApplyButton="false"  inputClass="inputstype"/>
                            至
                            <rich:calendar value="#{payAppCheck.qea.auditDateEnd}"
                                           locale="zh_CN"
                                           popup="true"
                                           datePattern="yyyy-MM-dd"
                                           showApplyButton="false"  inputClass="inputstype"/>
                        </h:panelGroup>
                        <h:outputLabel value="支付金额：" />
                        <h:panelGroup>
                            <h:inputText size="17" id="payaccountStart" value="#{payAppCheck.qea.payaccountStart}"/>
                            - <h:inputText size="17" id="payaccountEnd" value="#{payAppCheck.qea.payaccountEnd}"/>
                        </h:panelGroup>
                        <h:outputText value="支付日期："/>
                        <h:panelGroup>
                            <rich:calendar value="#{payAppCheck.qea.payDateStart}"
                                           locale="zh_CN"
                                           popup="true"
                                           datePattern="yyyy-MM-dd"
                                           showApplyButton="false"  inputClass="inputstype"/>
                            至
                            <rich:calendar value="#{payAppCheck.qea.payDateEnd}"
                                           locale="zh_CN"
                                           popup="true"
                                           datePattern="yyyy-MM-dd"
                                           showApplyButton="false"  inputClass="inputstype"/>
                        </h:panelGroup>                          
                        <h:inputHidden id="costcode" value="#{payAppCheck.qea.costitem.code}"/>
                    </h:panelGrid>
                </rich:collapsiblePanel>                   

                <h:commandButton value="查询" action="#{payAppCheck.queryAppList}"/>
                <h:commandButton value="取消" action="#{payAppCheck.cancel}"/>
                <h:commandButton value="导出Excel" action="#{payAppCheck.exportExcel}" disabled="#{payAppCheck.billModel.rowCount le 0}" />

                <div style="width:100%;overflow:auto">
                    <rich:dataTable id="appList" value="#{payAppCheck.billModel}" var="app" rows="10"
                                    style=" width: 1800px;">
                        <rich:column sortBy="#{app.number}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="单据编号"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:commandLink action="#{payAppCheck.showVoucher}" >
                                <h:outputText value="#{app.number}"/>
                            </h:commandLink>
                        </rich:column>
                        <rich:column sortBy="#{app.numDate}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="单据日期"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{app.numDate}">
                                <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                            </h:outputText>
                        </rich:column>
                        <rich:column sortBy="#{app.numberStatus}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="单据状态"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="等待审核"  rendered="#{app.numberStatus == '0'}" style="color:green"/>
                            <h:outputText value="审核通过"  rendered="#{app.numberStatus == '2'}" style="color:blue"/>
                            <h:outputText value="退回修改"  rendered="#{app.numberStatus == '3'}" style="color:red"/>
                            <h:outputText value="确认支付"  rendered="#{app.numberStatus == '4'}" style="color:blue"/>
                            <h:outputText value="支付完毕"  rendered="#{app.numberStatus == '6'}" style="color:blue"/>
                        </rich:column>
                        <rich:column sortBy="#{app.payDept.name}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="部门"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{app.payDept.name}"/>
                        </rich:column>
                        <rich:column sortBy="#{app.feePer.cpsn_name}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="经手人员"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{app.feePer.cpsn_name}"/>
                        </rich:column>
                        <rich:column sortBy="#{app.project.finName}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="预算项目"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{app.project.finName}"/>
                        </rich:column>

                        <rich:column sortBy="#{app.affair}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="报销内容"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{app.affair}"/>
                        </rich:column>

                        <rich:column sortBy="#{app.total}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="报销金额"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{app.total}">
                                <f:convertNumber type="number" pattern="#,##0.00"/>
                            </h:outputText>
                        </rich:column>

                        <rich:column sortBy="#{app.costClass}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="支出类别"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="基本支出" rendered="#{app.costClass == '0'}"/>
                            <h:outputText value="项目支出" rendered="#{app.costClass == '1'}"/>
                        </rich:column>

                        <rich:column sortBy="#{app.budgetSource}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="预算来源"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{app.budgetSource}"/>
                        </rich:column>

                        <rich:column sortBy="#{app.costitem.name}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="经济分类"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{app.costitem.name}"/>
                        </rich:column>

                        <rich:column sortBy="#{app.costTypes.name}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="支出渠道"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{app.costTypes.name}"/>
                        </rich:column>

                        <rich:column sortBy="#{app.paycode}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="支付令"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{app.paycode}" style="width:350px" />
                        </rich:column>

                        <rich:column sortBy="#{app.checkaccount}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="核定金额"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{app.checkaccount}">
                                <f:convertNumber type="number" pattern="#,##0.00"/>
                            </h:outputText>
                        </rich:column>

                        <rich:column sortBy="#{app.repayment}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="还款金额"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{app.repayment}">
                                <f:convertNumber type="number" pattern="#,##0.00"/>
                            </h:outputText>
                        </rich:column>

                        <rich:column sortBy="#{app.remain}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="待支付金额"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{app.remain}">
                                <f:convertNumber type="number" pattern="#,##0.00"/>
                            </h:outputText>
                        </rich:column>

                        <rich:column sortBy="#{app.auditDate}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="审核日期"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{app.auditDate}">
                                <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                            </h:outputText>
                        </rich:column>

                        <rich:column sortBy="#{app.auditor}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="审核人"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{app.auditor}"/>
                        </rich:column>

                        <rich:column sortBy="#{app.payaccount}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="支付金额"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{app.payaccount}">
                                <f:convertNumber type="number" pattern="#,##0.00"/>
                            </h:outputText>
                        </rich:column>

                        <rich:column sortBy="#{app.payDate}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="支付日期"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{app.payDate}">
                                <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                            </h:outputText>
                        </rich:column>

                        <rich:column sortBy="#{app.payer}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="出纳"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{app.payer}"/>
                        </rich:column>

                        <f:facet name="footer">
                            <rich:dataScroller id="ds"></rich:dataScroller>
                        </f:facet>
                    </rich:dataTable>
                </div>
            </rich:panel>
        </h:form>
        <rich:popupPanel id="projPanel" autosized="true">
            <f:facet name="header">项目信息</f:facet>
            <f:facet name="controls">
                <h:outputLink value="#" onclick="#{rich:component('projPanel')}.hide()">关闭</h:outputLink>
            </f:facet>
            <h:form id="projList">
                <rich:dataTable id="editTable" value="#{payAppCheck.finProjModel}" rows="10"  var="pro"
                                onrowmouseover="this.style.backgroundColor='#F1F1F1'"
                                onrowmouseout="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
                                rowClasses="list-row-odd,list-row-even">
                    <rich:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="预算项目编码"/>
                            </h:panelGroup>
                        </f:facet>
                        <a4j:commandLink id="Projlinks" action="#{payAppCheck.selectProjForQuery}"
                                         onclick="#{rich:component('projPanel')}.hide();"
                                         render="projName" >
                            <h:outputText value="#{pro.finCode}"/>
                        </a4j:commandLink>
                    </rich:column>

                    <rich:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="预算项目名称"/>
                            </h:panelGroup>
                        </f:facet>
                        <h:outputText value="#{pro.finName}"/>
                    </rich:column>
                    <rich:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="备注"/>
                            </h:panelGroup>
                        </f:facet>
                        <h:outputText value="#{pro.memo}"/>
                    </rich:column>

                    <f:facet name="footer">
                        <rich:dataScroller id="ds"></rich:dataScroller>
                    </f:facet>
                </rich:dataTable>
            </h:form>
        </rich:popupPanel>
        <rich:popupPanel id="deptPanel" autosized="true">
            <f:facet name="header">
                <h:panelGroup>
                    <h:outputText value="费用承担部门"></h:outputText>
                </h:panelGroup>
            </f:facet>
            <f:facet name="controls">
                <h:outputLink value="#" onclick="#{rich:component('deptPanel')}.hide()">关闭</h:outputLink>
            </f:facet>
            <h:form>
                <rich:panel>
                    <h:panelGrid columns="2" width="100%" border="0" id="mainform">
                        <rich:tree value="#{departmentBean.rootNode}" var="idept"
                                   selectionType="ajax" toggleType="client"
                                   selectionChangeListener="#{payAppCheck.selecteDeptForQuery}"
                                   style="width:300px" render="deptname">
                            <rich:treeNode>
                                <h:outputText value="[#{idept.data.code}]#{idept.data.name}" />
                                <rich:componentControl target="deptPanel" operation="hide" event="click"/>
                            </rich:treeNode>
                        </rich:tree>
                    </h:panelGrid>
                </rich:panel>
            </h:form>

            <f:facet name="footer">
                footer!
            </f:facet>

        </rich:popupPanel>
    </h:body>
</html>

